Jes.Index = {
	top : function(){
		Jes.html('center','<iframe frameborder="0" width="100%" id="main" scrolling="no" allowtransparency="true"></iframe>')	
		window.setInterval("Jes.reIframe('main')", 1000);
		var act = Jes.request("act");
		if(act != null){
			Jes.iframe(act+".html?"+window.location.search.substr(6+act.length));
		}else{
			this.ad();
			//Jes.sql({isSess:0,isLoad:false,ids:'1',sql:"vcount_update_hql@bs"},function(da){});
			Jes.save('TJesPv',{isSess:0,isLoad:0},_nocb);
			Jes.iframe('center.html');//默认
		}
		this.link();
	}
	,ad : function(){
		Jes.query('flowimg_query_sql@bl',{isSess:0,isLoad:false},function(da){
			if(Jes.isNull(da)) return;
			da = da[0];
			Jes.html('ad_img','<a target="_blank" href="'+da.url+'"><img src="'+DA.imgpath+da.img+'" border="0" width="'+da.width+'" height="'+da.height+'" alt="'+da.name+'"></a>');
			Jes.Ad.init(da);
		});
		Jes.query('couplet_query_sql@bl',{isSess:0,isLoad:false},function(da){
			if(Jes.isNull(da)) return;
			da = da[0];
			//对联
			Jes.Flt.item('fdiv1','10',2,'<br><a href="'+da.lefturl+'" target=_blank><img src="'+DA.imgpath+da.leftimg+'" alt="'+da.leftname+'" border="0"></a><br><img src="../themes/default/images/close.gif" border="0" style="cursor:pointer" onclick="javascript:Jes.hide(\'fdiv1\');">');
			Jes.Flt.item('fdiv2','document.body.clientWidth-106',2,'<br><a href="'+da.lefturl+'" target=_blank><img src="'+DA.imgpath+da.leftimg+'" alt="'+da.leftname+'" border="0"></a><br><img src="../themes/default/images/close.gif" border="0" style="cursor:pointer" onclick="javascript:Jes.hide(\'fdiv2\');">');
			Jes.Flt.play();
		});
	}
	,init : function(){
		this.notice('3');//公告
		this.imgNews('4');//要闻
		this.list('list_4',4);//要闻
		this.list('list_8',8);//国检
		this.fwdt('5');//服务
		this.ztzl('7');//专题
		this.imgRLink();
		this.imgShows('4');
		this.video();
	}
	,notice : function(menuid){
		var taEl=Jes('notice'),tr,td;
		Jes.page('topic_query_sql@bl',{isSess:0,isLoad:0,size:8,param:{menuid:menuid,isdue:1}},function(da){
			da =da.pageList;
			Jes.each(da,function(i){
				tr = Jes.Table.newTr(taEl);
				td = Jes.Table.newTd(tr,{vAlign:'top'},null,'<img vspace="8" src="../themes/default/images/flag9.gif">');
				td = Jes.Table.newTd(tr,null,null,'<a style="line-height:200%" title="'+da[i].title+'" href="index.html?act=infoshow&menuid='+da[i].fmenuid+'&infoid='+da[i].id+'" target="_blank">'+da[i].title.sub(22,1)+'</a><font class="fontCCCCCC">['+da[i].posttime.substr(5)+']</font>');
			});
			//initMarquees();
		});
	}
	,imgNews : function(menuid){
		var pics='',links='',texts='',p;
		var focus_width = 220,focus_height = 170,text_height = 20;
		var swf_height = focus_height + text_height;
		Jes.page('topic_query_sql@bl',{isSess:0,isLoad:0,size:5,param:{menuid:menuid}},function(da){
			da = da.pageList;
			Jes.each(da,function(i){
				p =(i==0)?'':'|';
				pics += p+DA.imgpath+da[i].img;
				links +=p+escape('index.html?act=infoshow&menuid='+da[i].fmenuid+'&infoid='+da[i].id);
				texts +=p+da[i].title;
			});
			var html =[];
			html.push('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + focus_width + '" height="' + swf_height + '">');
			html.push('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="../themes/default/images/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#FFF4F0">');
			html.push('<param name="menu" value="false"><param name=wmode value="opaque">');
			html.push('<param name="FlashVars" value="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '">');
			html.push('<embed src="../themes/default/images/pixviewer.swf" wmode="opaque" FlashVars="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + focus_width + '&borderheight=' + focus_height + '&textheight=' + text_height + '" menu="false" bgcolor="#ffffff" quality="high" width="' + focus_width + '" height="' + swf_height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
			html.push('</object>');
			Jes.html('imgnews',html);
		});
		//var pics = 'newsimg/newsimg19_1.jpg|newsimg/newsimg18_1.jpg|newsimg/newsimg17_1.jpg|newsimg/newsimg16_1.jpg|newsimg/newsimg15_1.jpg';
		//var links = 'info_show.asp?sysid=19|info_show.asp?sysid=18|info_show.asp?sysid=17|info_show.asp?sysid=16|info_show.asp?sysid=15';
		//var texts = '政策预警测试-局领导赴各现场工作...|情况通报测试-局领导赴各现场工作...|国检动态测试-局领导赴各现场工作...|服务外贸测试-局领导赴各现场工作...|把关查验测试-局领导赴各现场工作...'
	}
	,imgShows : function(menuid){
		var html =[];
		Jes.query('topic_query_sql@bl',{isSess:0,isLoad:false,param:{menuid:menuid}},function(da){
			Jes.each(da,function(i){
				if(i==0) html.push('<li>');
				if(i!=0 && i%4==0) html.push('</li><li>');
				html.push('<p><a href="index.html?act=infoshow&menuid='+da[i].fmenuid+'&infoid='+da[i].id+'" target="_blank"><img alt="" width="203" height="135" src="'+DA.imgpath+da[i].img+'"><span>'+da[i].title+'</span></a></p>');
			});
			html.push('</li>');
			Jes.html('pics',html);
			(function() {
                var vari = {
                    width: 955,
                    pics: document.getElementById("pics"),
                    prev: document.getElementById("prev"),
                    next: document.getElementById("next"),
                    len: document.getElementById("pics").getElementsByTagName("li").length,
                    intro: document.getElementById("pics").getElementsByTagName("p"),
                    now: 1,
                    step: 5,
                    dir: null,
                    span: null,
                    span2: null,
                    begin: null,
                    begin2: null,
                    end2: null,
                    move: function() {
                        if (parseInt(vari.pics.style.left, 10) > vari.dir * vari.now * vari.width && vari.dir == -1) {
                            vari.step = (vari.step < 2) ? 1 : (parseInt(vari.pics.style.left, 10) - vari.dir * vari.now * vari.width) / 5;
                            vari.pics.style.left = parseInt(vari.pics.style.left, 10) + vari.dir * vari.step + "px";
                        } else if (parseInt(vari.pics.style.left, 10) < -vari.dir * (vari.now - 2) * vari.width && vari.dir == 1) {
                            vari.step = (vari.step < 2) ? 1 : ( - vari.dir * (vari.now - 2) * vari.width - parseInt(vari.pics.style.left, 10)) / 5;
                            vari.pics.style.left = parseInt(vari.pics.style.left, 10) + vari.dir * vari.step + "px";
                        } else {
                            vari.now = vari.now - vari.dir;
                            clearInterval(vari.begin);
                            vari.begin = null;
                            vari.step = 5;
                            vari.width = 955;
                        }
                    },
                    scr: function() {
                        if (parseInt(vari.span.style.top, 10) > -31) {
                            vari.span.style.top = parseInt(vari.span.style.top, 10) - 5 + "px";
                        } else {
                            clearInterval(vari.begin2);
                            vari.begin2 = null;
                        }
                    },
                    stp: function() {
                        if (parseInt(vari.span2.style.top, 10) < 0) {
                            vari.span2.style.top = parseInt(vari.span2.style.top, 10) + 10 + "px";
                        } else {
                            clearInterval(vari.end2);
                            vari.end2 = null;
                        }
                    }
                };
                vari.prev.onclick = function() {
                    if (!vari.begin && vari.now != 1) {
                        vari.dir = 1;
                        vari.begin = setInterval(vari.move, 20);
                    } else if (!vari.begin && vari.now == 1) {
                        vari.dir = -1,vari.width *= vari.len - 1;
                        vari.begin = setInterval(vari.move, 20);
                    };
                };
                vari.next.onclick = function() {
                    if (!vari.begin && vari.now != vari.len) {
                        vari.dir = -1;
                        vari.begin = setInterval(vari.move, 20);
                    } else if (!vari.begin && vari.now == vari.len) {
                        vari.dir = 1,vari.width *= vari.len - 1;
                        vari.begin = setInterval(vari.move, 20);
                    };
                };
                for (var i = 0; i < vari.intro.length; i++) {
                    vari.intro[i].onmouseover = function() {
                        vari.span = this.getElementsByTagName("span")[0];
                        vari.span.style.top = 0 + "px";
                        if (vari.begin2) {
                            clearInterval(vari.begin2);
                        }
                        vari.begin2 = setInterval(vari.scr, 20);
                    };
                    vari.intro[i].onmouseout = function() {
                        vari.span2 = this.getElementsByTagName("span")[0];
                        if (vari.begin2) {
                            clearInterval(vari.begin2);
                        }
                        if (vari.end2) {
                            clearInterval(vari.end2);
                        }
                        vari.end2 = setInterval(vari.stp, 5);
                    };
                }
            })();
		});
	}
	,list : function(el,menuid){
		var taEl=Jes(el),tr,td,c;
		Jes.query('topic_query_sql@bl',{isSess:0,isLoad:0,page:8,param:{menuid:menuid}},function(da){
			Jes.each(da,function(i){
				c=(i%2==0)?'':'#eef9ff';
				tr = Jes.Table.newTr(taEl,{bgColor:c});
				Jes.Table.newTd(tr,{height:'28px',align:'center'},null,'<img src="../themes/default/images/flag8.gif">');
				Jes.Table.newTd(tr,null,null,'<a title="'+da[i].title+'" href="index.html?act=infoshow&menuid='+da[i].fmenuid+'&infoid='+da[i].id+'" target=_blank>'+da[i].title+'</a>');
				Jes.Table.newTd(tr,{className:'fontCCCCCC',width:'54px'},null,'['+da[i].posttime.substr(5)+']');
			});
		});
	}
	//专题转栏
	,ztzl : function(menuid){
		Jes.action('listMenu@App',menuid,function(da){
			var taEl=Jes('ztzl_menu'),tr,img,url;
			Jes.each(da,function(i){
				if(i==4) return false;
				tr=Jes.Table.newTr(taEl);
				img=da[i][2]=='1'?'<img alt="'+da[i][1]+'" src="'+DA.imgpath+da[i][3]+'">':da[i][1];
				url=da[i][4]=='1'?da[i][5]:Jes.sysUrl('info',{menuid:da[i][0]});
				Jes.Table.newTd(tr,{height:'75px'},null,'<a href="'+url+'" target="_blank">'+img+'</a>');
			});
		});
	}
	,link : function(){
		this.imgLink1();
		this.imgLink2();
		Jes.Select.idxLink('link1',{type:3,isSess:0},'--出入境检验检疫局链接');
		Jes.Select.idxLink('link2',{type:5,isSess:0},'--党政机关链接');
		Jes.Select.idxLink('link3',{type:4,isSess:0},'--企业网站链接');
		Jes.Select.idxLink('link4',{type:6,isSess:0},'--常用网站链接');
	}
	,imgLink1 : function(){
		var taEl=Jes('imglink1'),tr=Jes.Table.newTr(taEl),td;
		Jes.query('idxlink_query_sql@sel',{isSess:0,isLoad:false,param:{type:7}},function(da){
			Jes.each(da,function(i){
				Jes.Table.newTd(tr,{width:'120',align:'center'},null,'<a href="'+da[i].id+'" target="_blank"><img border=0 src="'+DA.imgpath+da[i].logo+'"></a>');
			});
		});
	}
	,imgLink2 : function(){
		var taEl=Jes('imglink2'),tr=Jes.Table.newTr(taEl),td;
		Jes.query('idxlink_query_sql@sel',{isSess:0,isLoad:false,param:{type:2}},function(da){
			Jes.each(da,function(i){
				Jes.Table.newTd(tr,{align:'center'},null,'<a href="'+da[i].id+'" target="_blank"><img border=0 src="'+DA.imgpath+da[i].logo+'"></a>');
			});
		});
	}
	//右边的图片链接
	,imgRLink : function(){
		var taEl=Jes('rightimg_link'),tr,td;
		Jes.query('idxlink_query_sql@sel',{isSess:0,isLoad:false,param:{type:8}},function(da){
			Jes.each(da,function(i){
				tr=Jes.Table.newTr(taEl);
				Jes.Table.newTd(tr,{height:'30',vAlign:'top'},null,'<a href="'+da[i].id+'"><img border="0" src="'+DA.imgpath+da[i].logo+'"></a>');
			});
		});
	}
	//服务大厅
	,fwdt : function(menuid){
		Jes.action('listMenu@App',menuid,function(da){
			var taEl=Jes('fwdt_menu'),tr=Jes.Table.newTr(taEl),cls,cls_a,url;
			Jes.each(da,function(i){
				if(i>4) return false;
				if(i==0){
					cls='table_td2',cls_a='table_td_a2';
					Jes.Index.fwdtMore(da[i][0]);
				}else{
					cls='table_td1',cls_a='table_td_a1';
				}
				Jes.Table.newTd(tr,{width:'3px'});
				url=da[i][4]==1?da[i][5]:Jes.sysUrl('info',{menuid:da[i][0]});
				Jes.Table.newTd(tr,{width:'70',align:'center',id:'TabTitle',className:cls},null,'<a href="'+url+'" target="_blank" onMouseOver="javascript:ShowTabs(\'TabTitle\',\'Tabs\','+i+');Jes.Index.fwdtMore(\''+da[i][0]+'\')"class="'+cls_a+'">'+da[i][1]+'</a>');
			});
		});
	}
	,fwdtMore : function(menuid){
		var da = DA.FWDT['LEV_'+menuid],da1;
		if(!da){
			Jes.sync(function(){
				Jes.action('listMenuDeep@App',{menuid:menuid,getChild:'1'},function(_da){
					DA.FWDT['LEV_'+menuid]=_da;
				});
			});
		}
		da=DA.FWDT['LEV_'+menuid];
		DWRUtil.removeAllRows('Tabs');
		var taEl = Jes('Tabs'),tr,td,url;
		Jes.each(da,function(i){//lev1
			tr=Jes.Table.newTr(taEl);
			url=da[i]['node'][4]==1?da[i]['node'][5]:Jes.sysUrl('info',{menuid:da[i]['node'][0]});
			Jes.Table.newTd(tr,{height:'25',align:'center'},null,'<a href="'+url+'" target="_blank">'+da[i]['node'][1]+'</a>');
			da1= da[i]['childNode'];
			Jes.each(da1,function(j){//lev2
				if(j>3) return false;
				url=da1[j][4]==1?da1[j][5]:Jes.sysUrl('info',{menuid:da1[j][0]});
				Jes.Table.newTd(tr,{align:'center'},null,'<a href="'+Jes.sysUrl('info',{menuid:da1[j][0]})+'" target="_blank"><img src="../themes/default/images/zhinan.gif" width="14" height="14" border="0"></a>');
			});
			tr=Jes.Table.newTr(taEl);
			Jes.Table.newTd(tr,{height:'1',colSpan:'4',background:'../themes/default/images/line1.jpg',align:'center'});
		});
	}
	,video : function(){
		var taEl=Jes('notice'),tr,td;
		Jes.page('topic_query_sql@bl',{isSess:0,isLoad:0,page:0,size:1,param:{istvideo:1}},function(da){
			da = da.pageList[0];
			Jes.val('video','<embed src="'+da.vurl+'" width="200" height="105" autostart="no"></embed>');
		});
	}
}

function ShowTabs(title, tab, num) {
	var tabTitles = Jes.name(title),tabs = Jes.name(tab);
	Jes.each(tabTitles,function(i){
		if(num==i){
			//Jes.show(tabs[i]);
			tabTitles[i].className='table_td2';
			Jes.tag('A',tabTitles[i])[0].className='table_td_a2';
		}else{
			tabTitles[i].className='table_td1';
			Jes.tag('A',tabTitles[i])[0].className='table_td_a1';
			//Jes.hide(tabs[i]);
		}
	});

}